﻿@model AutomatedTestDataManagement.Models.TestScenario

@{
    ViewBag.Title = "Edit";
}

<h2>Edit Test Scenario</h2>

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>TestScenario</legend>

            @Html.HiddenFor(model => model.ScenarioID)
            @if (ViewBag.SuiteID != null)
            {
                <input type="hidden" name="SuiteID" id="SuiteID" value="@ViewBag.SuiteID" />
            }

        <div class="editor-label">
            @Html.LabelFor(model => model.ScenarioName, "Scenario Name")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ScenarioName)
            @Html.ValidationMessageFor(model => model.ScenarioName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ScenarioDescription, "Scenario Description")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ScenarioDescription)
            @Html.ValidationMessageFor(model => model.ScenarioDescription)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.TFSID, "Item Tracking ID")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TFSID)
            @Html.ValidationMessageFor(model => model.TFSID)
        </div>
        <div class="editor-label">@Html.LabelFor(model => model.TestScenarioTests, "Tests in Scenario")</div>
            <div class="editor-field">
               <table>
                   <tr>
                       <th>Test Name</th>
                       <th>Test Description</th>
                       <th>Order In Scenario</th>
                       <th></th>
                   </tr>
                   @if (ViewBag.SuiteID == null)
                   {
                    @Html.EditorFor(m => m.TestScenarioTests)
                   }
                   else
                   {
                       @Html.EditorFor(m => m.TestScenarioTests, new ViewDataDictionary{{"SuiteID", ViewBag.SuiteID}})
                   }
                 </table>
              </div>
        <p>
            @Html.ActionLink("Add Tests to Scenario", "Create", "ScenariosTest", new { id = Model.ScenarioID, suiteID = ViewBag.SuiteID }, null)
        </p>
        

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @if(ViewBag.SuiteID != null)
    {
        @Html.ActionLink("Return to Test Suite", "Edit", "Suite", new { id = ViewBag.SuiteID }, null) @Html.Encode(" | ") 
    } 
    @Html.Partial("_TestSuiteNav")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
